#接口对象层
#导包
from utils.SendMethod import SendMethod


class Event:
    #封装ulr
    def __init__(self):
        self.url="http://127.0.0.1:8000"
    #添加发布会
    def add_event(self,body):
        url = self.url + "/api/add_event/"
        method = "post"
        return SendMethod.send_method(method=method,url=url,body =body)
    #查询发布会
    def get_event(self,params):
        url=self.url + "/api/get_event_list/"
        return SendMethod.send_method("get",url =url ,params=params)
    #添加嘉宾接口
    def add_guest(self, body):
        url = self.url + "/api/add_quest/"
        method = "post"
        return SendMethod.send_method(method=method,url=url,params =params)
    #查询嘉宾接口
    def get_guest(self,params):
        url =self.url + "/api/get_quest"
        method ="get"
        return SendMethod.send_method(method=method, url=url, params=params)

if __name__ == '__main__':
    payload = {
        "eid": "1888",
        "name": "魅族发布会222",
        "limit": "20",
        "status": "1",
        "address": "武汉源码时代",
        "start_time": "2022-07-21"
    }
    params = {
        "eid": "1888",
        "name": "魅族发布会222"
    }
    body_guest={
        "eid":"1999",
        "realname":"sun",
        "phone":"13000000000",
        "email":"xxx@163.com.cn"
    }
    params_guest ={
        "eid" :"555",
        "phone":"13100000000"
    }
    #添加发布会
    print(Event().add_event(payload))
    #查询发布会
    # print(Event().get_event(params))
    # #添加嘉宾
    # print(Event().add_guest(body_guest))
    # #查询嘉宾
    # print(Event().get_guest(params_guest))
